package com.hwz.mapper;

import com.github.pagehelper.Page;
import com.hwz.annotation.AutoFill;
import com.hwz.dto.EmployeePageQueryDTO;
import com.hwz.entity.Employee;
import com.hwz.enumeration.OperationType;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface EmployeeMapper {

    /**
     * 根据用户名查询员工
     * @param username
     * @return
     */
    @Select("select * from employee where username = #{username}")
    Employee getByUsername(String username);

    /**
     * 新增员工
     * @param employee
     */
    @AutoFill(value =  OperationType.INSERT)
    void insert(Employee employee);

    /**
     * 根据条件查询员工
     * @param employeePageQueryDTO
     * @return
     */
    Page<Employee> selectByCondition(EmployeePageQueryDTO employeePageQueryDTO);

    /**
     * 更新员工信息
     * @param employee
     */
    @AutoFill(value =  OperationType.UPDATE)
    void update(Employee employee);

    /**
     * 根据Id查询员工
     * @param id
     * @return
     */
    Employee getById(Long id);
}
